// 串行读取2个文件
//fs 读取的路径是 跟目录开始的。
const fs = require("fs");
function promisify(readFile){
    return function(filename,encoding){
        return new Promise(function(resolve,reject){
            readFile(filename,encoding,function(err,data){
                if(err){
                    reject(err);
                }else{
                    resolve(data);
                }
            })
        })
    }
}
//异步回调，返回一个promise 
let readFile  = promisify(fs.readFile);
(async function read(params) {
    let one = await readFile("1.txt","utf8");
    let two = await readFile("2.txt","utf8");
    console.log(one,two)
})()